package com.muyi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyi.pojo.entity.User;
import com.muyi.service.UserService;
import com.muyi.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author VRMMO
* @description 针对表【user】的数据库操作Service实现
* @createDate 2025-06-15 18:44:06
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> list() {
        return userMapper.list();
    }

    @Override
    public void delete(Integer id) {
        userMapper.deleteById(id);
    }

    @Override
    public void add(User user) {
        userMapper.insertAll(user);
    }

    @Override
    public void update(User user) {
        userMapper.update(user);
    }

    @Override
    public User getByUserId(Integer id) {
        return userMapper.getByUserId(id);
    }

    @Override
    public User login(User user) {
        return userMapper.getByUsernameAndPassword(user);
    }


}




